package week07

// 205. 同构字符串
// https://leetcode-cn.com/problems/isomorphic-strings/

func isIsomorphic(s string, t string) bool {
	var s2t = make(map[byte]byte)
	var t2s = make(map[byte]byte)
	for i := range s {
		s1, t1 := s[i], t[i]
		if s2t[s1] > 0 && s2t[s1] != t1 || t2s[t1] > 0 && t2s[t1] != s1 {
			return false
		}
		s2t[s1] = t1
		t2s[t1] = s1
	}
	return true
}